#ifndef GRUBVERIFY_H
#define GRUBVERIFY_H

#include <QDialog>
#include <QLineEdit>
#include <QLabel>
#include <QHBoxLayout>
#include <QPushButton>
#include <QEvent>
#include <QKeyEvent>

class GrubVerify : public QDialog
{
    Q_OBJECT
public:
    explicit GrubVerify(QWidget *parent = nullptr);
    ~GrubVerify();

    QPushButton *getConfirmBtn();
    QString getPwd();

private:

    QVBoxLayout * mainVerLayout;
    QVBoxLayout * contentVerLayout;
    QHBoxLayout * userHorLayout;
    QHBoxLayout * newPwdHorLayout;
    QHBoxLayout * surePwdHorLayout;
    QHBoxLayout * bottomBtnsHorLayout;
    QHBoxLayout *newTipHorLayout;
    QHBoxLayout *sureTipHorLayout;
    QString newPwdTip;
    QString surePwdTip;

    QPushButton *cancelBtn;
    QPushButton *confirmBtn;

    QLabel *userLabel;
    QLabel *curTipLabel;
    QLabel *newPwdLabel;
    QLabel *newTipLabel;
    QLabel *surePwdLabel;
    QLabel *sureTipLabel;

    QLabel * usernameLabel;
    QLineEdit * newPwdLineEdit;
    QLineEdit * surePwdLineEdit;

    QPushButton *currentPwdEyeBtn;
    QPushButton *newPwdEyeBtn;
    QPushButton *surePwdEyeBtn;

private:
    void initUI();
    void setupConnect();
    bool setTextDynamicInPwd(QLabel * label, QString string);
    void checkPwdLegality();
    void updateTipLableInfo(QLabel *Label,QString info);
    void refreshConfirmBtnStatus();

protected:
    bool eventFilter(QObject *target, QEvent *event);
    void keyPressEvent(QKeyEvent *);
signals:


};

#endif // GRUBVERIFY_H
